package com.lunz.machine.widget;

import android.graphics.Rect;
import android.os.Build;
import android.view.View;
import android.widget.PopupWindow;

/**
 * @ClassName TimePopupWindow
 * @Description 首页时间选择Popwindow
 * @Author ：WangZhuang
 * @Date : 2020/10/14 16:49
 * @Version :
 */
public class TimePopupWindow extends PopupWindow {


    public TimePopupWindow(View contentView, int width, int height) {
        super(contentView, width, height);
    }

    @Override
    public void showAsDropDown(View anchor) {
        if (Build.VERSION.SDK_INT >= 24) {
            Rect ew = new Rect();
            anchor.getGlobalVisibleRect(ew);
            int height = anchor.getResources().getDisplayMetrics().heightPixels - ew.top + 100;
            setHeight(height);
        }

        super.showAsDropDown(anchor);
    }
}

